package exfist;
/**
 * The keys for each player.
 *
 * @author "Brian MacCarthy";
 * @created "2007-03-04 Brian MacCarthy";
 * @revised "$Date: 2007-03-06 19:11:00 $"; 
 */
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.KeyStroke;

public class KeyBindings extends JComponent
{
	private Punches p;
	private Kicks k;
	private Movement m;
	private int x;
	protected KeyBindings()
	{
		p = new Punches();
		k = new Kicks(); 
		m = new Movement();
		this.Player1_Keys();	
	}
	private void Player1_Keys()
	{
		//movement
		this.getInputMap().put(KeyStroke.getKeyStroke('i'), "P1_up");
		this.getInputMap().put(KeyStroke.getKeyStroke('k'), "P1_down");
		this.getInputMap().put(KeyStroke.getKeyStroke('j'), "P1_left");
		this.getInputMap().put(KeyStroke.getKeyStroke('l'), "P1_right");
		this.getActionMap().put("P1_up", P1_up);
		this.getActionMap().put("P1_down", P1_down);
		this.getActionMap().put("P1_left", P1_left);
		this.getActionMap().put("P1_right", P1_right);
		
		//punches/kicks
		this.getInputMap().put(KeyStroke.getKeyStroke('q'), "P1_light_punch");
		this.getInputMap().put(KeyStroke.getKeyStroke('w'), "P1_medium_punch");
		this.getInputMap().put(KeyStroke.getKeyStroke('e'), "P1_strong_punch");
		this.getInputMap().put(KeyStroke.getKeyStroke('a'), "P1_light_kick");
		this.getInputMap().put(KeyStroke.getKeyStroke('s'), "P1_medium_kick");
		this.getInputMap().put(KeyStroke.getKeyStroke('d'), "P1_strong_kick");
		this.getActionMap().put("P1_light_punch", P1_light_punch);
		this.getActionMap().put("P1_medium_punch", P1_medium_punch);
		this.getActionMap().put("P1_strong_punch", P1_strong_punch);
		this.getActionMap().put("P1_light_kick", P1_light_kick);
		this.getActionMap().put("P1_medium_kick", P1_medium_kick);
		this.getActionMap().put("P1_strong_kick", P1_strong_kick);
	}
	private void Player2_Keys()
	{
	//	movement
		this.getInputMap().put(KeyStroke.getKeyStroke('t'), "P2_up");
		this.getInputMap().put(KeyStroke.getKeyStroke('g'), "P2_down");
		this.getInputMap().put(KeyStroke.getKeyStroke('f'), "P2_left");
		this.getInputMap().put(KeyStroke.getKeyStroke('h'), "P2_right");
		this.getActionMap().put("P2_up", P2_up);
		this.getActionMap().put("P2_down", P2_down);
		this.getActionMap().put("P2_left", P2_left);
		this.getActionMap().put("P2_right", P2_right);
		
		//punches/kicks
		this.getInputMap().put(KeyStroke.getKeyStroke('z'), "P2_light_punch");
		this.getInputMap().put(KeyStroke.getKeyStroke('x'), "P2_medium_punch");
		this.getInputMap().put(KeyStroke.getKeyStroke('c'), "P2_strong_punch");
		this.getInputMap().put(KeyStroke.getKeyStroke('v'), "P2_light_kick");
		this.getInputMap().put(KeyStroke.getKeyStroke('b'), "P2_medium_kick");
		this.getInputMap().put(KeyStroke.getKeyStroke('n'), "P2_strong_kick");
		this.getActionMap().put("P2_light_punch", P2_light_punch);
		this.getActionMap().put("P2_medium_punch", P2_medium_punch);
		this.getActionMap().put("P2_strong_punch", P2_strong_punch);
		this.getActionMap().put("P2_light_kick", P2_light_kick);
		this.getActionMap().put("P2_medium_kick", P2_medium_kick);
		this.getActionMap().put("P2_strong_kick", P2_strong_kick);
	}
	Action P1_up = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed up");
	    }
	};
	Action P1_down = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed down");
	    }
	};
	Action P1_left = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed left");
	    }
	};
	Action P1_right = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed right");
	    }
	};
	
	
	Action P1_light_punch = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	    	x = p.weakPunch();
	        System.out.println(x);
	    }
	};
	Action P1_medium_punch = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	    	x = p.medPunch();
	        System.out.println(x);
	    }
	};
	Action P1_strong_punch = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        x = p.strongPunch();
	        System.out.println(x);
	    }
	};
	Action P1_light_kick = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        x=k.weakKick();
	        System.out.println(x);
	    }
	};
	Action P1_medium_kick = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	    	x=k.medKick();
	    	System.out.println(x);
	    }
	};
	Action P1_strong_kick = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e)
	    {
	    	x=k.stongkick();
	        System.out.println(x);
	    }
	};
	
	Action P2_up = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed up");
	    }
	};
	Action P2_down = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed down");
	    }
	};
	Action P2_left = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed left");
	    }
	};
	Action P2_right = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        System.out.println("Player 1 pressed right");
	    }
	};
	
	Action P2_light_punch = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	    	x = p.weakPunch();
	        System.out.println(x);
	    }
	};
	Action P2_medium_punch = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	    	x = p.medPunch();
	        System.out.println(x);
	    }
	};
	Action P2_strong_punch = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        x = p.strongPunch();
	        System.out.println(x);
	    }
	};
	Action P2_light_kick = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	        x=k.weakKick();
	        System.out.println(x);
	    }
	};
	Action P2_medium_kick = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e) 
	    {
	    	x=k.medKick();
	    	System.out.println(x);
	    }
	};
	Action P2_strong_kick = new AbstractAction() 
	{
	    public void actionPerformed(ActionEvent e)
	    {
	    	x=k.stongkick();
	        System.out.println(x);
	    }
	};

}